package com.innovation.chengzhangriji.http;

import com.google.gson.annotations.SerializedName;
import com.innovation.library.http.InnovationRequestBody;

public class AudioUploadRequest extends BaseUploadRequest {

    public static final String PATH = BaseRequest.PATH + "api/post_audio";

    private int length;

    private String audioUrl;

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public String getAudioUrl() {
        return audioUrl;
    }

    public void setAudioUrl(String audioUrl) {
        this.audioUrl = audioUrl;
    }

    @Override
    protected InnovationRequestBody getInnovationRequestBody() {
        AudioUploadRequestBody body = new AudioUploadRequestBody();
        body.setPhone(getPhone());
        body.setToken(getToken());
        body.setUuid(getUuid());
        body.setBabyID(getBabyID());
        body.setLength(getLength());
        body.setAudioUrl(getAudioUrl());
        body.setLabel(getLabel());
        body.setLabelId(getLabelId());
        body.setCreateTS(getCreateTS());
        return body;
    }

    private class AudioUploadRequestBody extends BaseUploadRequestBody {

        @SerializedName("Duration")
        private int length;

        @SerializedName("Audio")
        private String audioUrl;

        private AudioUploadRequestBody() {
            setSv(BaseRequestConfig.SV_AUDIO_UPLOAD);
        }

        public int getLength() {
            return length;
        }

        public void setLength(int length) {
            this.length = length;
        }

        public String getAudioUrl() {
            return audioUrl;
        }

        public void setAudioUrl(String audioUrl) {
            this.audioUrl = audioUrl;
        }
    }
}
